from strategy.StrategyTemplate import StrategyTemplate
from utils.db import DbHandler
import pandas as pd
from strategy.big_data.big_data_common import concept_column

class ConceptPrice(StrategyTemplate):
    """
    概念板块最新行情指标

    """
    def __init__(self):
        super(ConceptPrice, self).__init__()
        self.strategy_name = "概念板块最新行情指标"
        self.strategy_descrption = "概念板块最新行情指标"

    def run(self):
        db = DbHandler()
        db.create_session()
        pd_concepts_price = pd.read_sql_table('QS_concepts_price', con=db.engine)

    def api(self, size=10):
        db = DbHandler()
        db.create_session()
        pd_concepts_price = pd.read_sql_table('QS_concepts_price', con=db.engine)
        pd_concepts_price = pd_concepts_price[concept_column]
        pd_concepts_price.reset_index(inplace=True, drop=True)
        db.close_session()
        return pd_concepts_price

if __name__ == '__main__':
    ins = ConceptPrice()
    # ins.topN = 20
    ins.run()

